<template>
  <el-card class="class-model-card" :style="getStyle">
    <div class="class-model">
      <div class="class-model-img">
        <slot name="class-img">
          <img :src="src" alt="">
        </slot>

      </div>
      <div class="class-model-name">
        <slot name="class-name">英语四级</slot>
      </div>
      <div class="class-model-a">
        <slot name="class-buy"><a>马上购买</a></slot>
      </div>
      <div class="class-model-cancel">
        <slot name="class-cancel" /></div>
    </div>
  </el-card>
</template>

<script>
export default {
  name: 'ClassModel',
  props: ['widthHeight'],
  data() {
    return {
      src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
    }
  },
  computed: {
    getStyle() {
      return this.widthHeight
    }
  },
  mounted() {
    // console.log(this.widthHeight)
  }
}
</script>

<style lang="scss" scoped>
.class-model-card {
  position: relative;
  margin: 20px;
  margin-top: 50px;
  margin-bottom: 0;
  height: 160px;
  width: 150px;
  //  &:last-child{
  //     margin-right:auto;
  //     color: red;
  //   }
  .class-model {
    .class-model-img {
      position: absolute;
      width: 100%;
      height: 60%;
      border-bottom: 2px solid #ccc;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .class-model-name {
      position: absolute;
      top: 75%;
      left: 50%;
      text-align: center;
      transform: translate(-50%, -50%);
      font-size: 17px;
      color: rgb(100, 100, 100);
    }
    .class-model-a {
      position: absolute;
      top: 80%;
      right: 3%;
      font-size: 13px;
      color: rgb(140, 140, 140);
      padding: 5% 2%;
    }
    .class-model-cancel {
      position: absolute;
      top: 90%;
      left: 2%;
      color: rgb(190, 190, 190);
    }
  }
}
</style>
